-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-balance roles deterministically instead of randomly #209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring proposal!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Carl! Great work! I have some comments regarding the logic we use to recompute the roles based on the count of only the nodes of the current cluster, whereas we should be based on the entirety of the fleet
(for auto-generated roles) Algorithm: - if odd # of nodes: all nodes are cluster manager eligible - if even # of nodes: node with highest unit number is data node, all other nodes are cluster manager eligible Replaces old algorithm of `random.choice` one of the nodes that should change roles This will enable in-place upgrades to be ordered from highest to lowest unit number even if roles are re-balanced (for HA [e.g. because of network cut]) while upgrade is in-progress That allows upgrade/rollback to be coordinated without leader unit setting information in peer databag, which allows partial rollback even if leader unit is in error state --- Also, this algorithm ensures that if a unit needs to be restarted for HA while upgrade in-progress, a unit (the highest number unit) on the newer version of the charm/workload will be upgraded. This reduces the likelihood that: - one of the last units on the older version restarts and - the cluster manager switches to operating with the new workload version (i.e. it stops operating in compatability mode with the old version—see https://discuss.elastic.co/t/rolling-upgrades-master-nodes-voting-config-exclusions/320463/2) which means that units on the old version cannot re-connect to the cluster
Highest unit number cannot always be determined (e.g. if unit hasn't joined peer relation). Unable to use `planned_units` since unit numbers are not necessarily sequential
max([]) raises ValueError
319a736
to
0b97602
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Carl!
(for auto-generated roles)
Algorithm:
Replaces old algorithm of
random.choice
one of the nodes that should change rolesThis will enable in-place upgrades to be ordered from highest to lowest unit number even if roles are re-balanced (for HA [e.g. because of network cut]) while upgrade is in-progress
That allows upgrade/rollback to be coordinated without leader unit setting information in peer databag, which allows partial rollback even if leader unit is in error state
Context:
https://chat.canonical.com/canonical/pl/zpqoyei54ffr5kwgwkbimizhwo
https://warthogs.atlassian.net/browse/DPE-3878
Also, this algorithm ensures that if a unit needs to be restarted for HA while upgrade in-progress, a unit (the highest number unit) on the newer version of the charm/workload will be upgraded. This reduces the likelihood that:
which would mean that units on the old version could not re-connect to the cluster